﻿using System;
using System.Collections.Generic;
using System.Text;
using Task.Common.Interface;
using System.Collections;
using Task.Common.Entity;

namespace Task.Logic
{
    class DelegationLogic:IDelegation
    {
        public List<DelegationEntitiy> GetList(string whereStr)
        {
            Hashtable table = new Hashtable();
            table.Add("whereStr", whereStr);
            return DataHelper.Instance().GetList<DelegationEntitiy>("DelegationLogic_GetList", table);
        }

        public void InsertData(DelegationEntitiy entity)
        {
            Hashtable ht = new Hashtable();
            ht.Add("DELEGATION_ID",entity.DELEGATION_ID);
            ht.Add("PROCESS_NAME", entity.PROCESS_NAME);
            ht.Add("STEP_NAME", entity.STEP_NAME);
            ht.Add("TASK_USER",entity.TASK_USER);
            ht.Add("DELEGATOR_USER", entity.DELEGATOR_USER);
            ht.Add("START_DATE", entity.START_DATE);
            ht.Add("END_DATE", entity.END_DATE);
            ht.Add("COMMENT",entity.COMMENT);
            ht.Add("CREATE_DATE", entity.CREATE_DATE);
            ht.Add("CREATE_BY", entity.CREATE_BY);
            ht.Add("UPDATE_DATE", entity.UPDATE_DATE);
            ht.Add("UPDATE_BY", entity.UPDATE_BY);
            ht.Add("EFFECT_FROM", entity.EFFECT_FROM);
            ht.Add("EFFECT_TO", entity.EFFECT_TO);
            ht.Add("IS_ACTIVE", entity.IS_ACTIVE);
            ht.Add("DELEGATOR_STATUS",entity.DELEGATOR_STATUS);
            ht.Add("Summary",entity.Summary);
            DataHelper.Instance().Insert("DelegationLogic_InsertData", ht);
        }

        public int UpdateData(string str,int status)
        {
            Hashtable ht = new Hashtable();
            ht.Add("str", str);
            ht.Add("status", status);
            return DataHelper.Instance().Update("DelegationLogic_UpdateData", ht);
        }
    }
}
